-
Notifications
You must be signed in to change notification settings - Fork 230
Add the Box class for specifying the box of GMT embellishments #3995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dd01578
to
d9ccd1f
Compare
7aa3bf8
to
37ed709
Compare
Co-authored-by: Michael Grund <[email protected]> Co-authored-by: Yvonne Fröhlich <[email protected]>
311c83f
to
926a690
Compare
…iasSystem/params/base
@GenericMappingTools/pygmt-maintainers Please give this PR a high priority, since many PRs are waiting for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just two suggestions, one on ordering the docs, another one on making class BaseParam
and AbstractBaseClass.
pygmt/params/base.py
Outdated
""" | ||
|
||
|
||
class BaseParam: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should make this an AbstractBaseClass (was debating between ABC or a Protocol).
class BaseParam: | |
from abc import ABC, abstractmethod, abstractproperty | |
class BaseParam(ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've applied the suggestions but also made some changes in c6bd16f. The main changes are:
abstractproperty
is deprecated https://docs.python.org/3/library/abc.html#abc.abstractproperty. Now use@property
and@abstractmethod
.@abstractmethod
means subclasses must implement the method/property, so theNotImplementedError
is not needed and can be removed.- The
_validate
method is meant to be optional, so we can't use@abstractmethod
. Then ruff reports theB027
error, and it's ignored by adding thenoqa
flag.
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Wei Ji <[email protected]>
- abstractproperty is deprecated - _validate is optional, so we can't use @AbstractMethod - improve docstrings
This PR implements the
Box
class that can be used in modules likecoast
/image
/legend
/colorbar
/....The full GMT CLI syntax is (https://docs.generic-mapping-tools.org/6.6/colorbar.html#f):
The upstream long-form names are available at:
https://github.com/GenericMappingTools/gmt/blob/7026382558e11f89e2238bb345e1d0af325c12aa/src/longopt/psscale_inc.h#L35
The
Box
class follows the upstream long-form names, but useinner_gap
/inner_pen
for+i
andshade_offset
/shade_fill
for+s
.Preview: